class word:

    def __init__(self, name):
        self.count = 0
        self.name = name
        self.locations = []
    
    def __eq__(self, other):
        return self.name == other.name and self.count==other.count
    
    def incrementCount(self):
        self.count += 1
       
    def getAvgLoc(self):
        """
        Return the average of all the locations in the 
        location array. 
        """
        sum = 0
        for location_index in range(len(self.locations)):
            sum += self.locations[location_index]
        return sum/len(self.locations)
    
    def updateWord(self, location):
        """
        1. Increment the word's count in the word_objects list and
        2. Add the new location associated with the word
        """
        self.incrementCount()
        self.locations.append(location)